package com.huike.clues.mapper;


import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 线索跟进记录Mapper接口
 * @date 2021-04-19
 */
public interface TbClueTrackRecordMapper {

    @Insert("INSERT INTO tb_clue_track_record " +
            "(id,clue_id,create_by,subject,record,level,create_time,type,false_reason,next_time) " +
            "VALUES " +
            "(null, #{clueId}, #{createBy}, #{subject},#{record},#{level},#{createTime},#{type},#{falseReason},#{nextTime})")
    void addFollowUp(ClueTrackRecordVo tbClueTrackRecord);

    @Update("UPDATE tb_clue SET name=#{name},sex=#{sex},weixin=#{weixin},qq=#{qq},age=#{age} WHERE id = #{clueId}")
    void updateClue(ClueTrackRecordVo tbClueTrackRecord);

    @Select("SELECT * FROM tb_clue_track_record where clue_id=#{clueId}")
    List<TbClueTrackRecord> list(Long clueId);
}
